const state = {
  availableServices: [],
  serviceCategories: []
}

const mutations = {
  SET_AVAILABLE_SERVICES(state, services) {
    state.availableServices = services
  },
  SET_SERVICE_CATEGORIES(state, categories) {
    state.serviceCategories = categories
  }
}

const actions = {
  // 加载可用服务
  async loadAvailableServices({ commit }) {
    try {
      // 模拟API调用
      const mockServices = [
        {
          id: '1',
          name: '在线问诊',
          description: '与医生在线沟通',
          icon: 'icon-message-circle',
          available: true
        },
        {
          id: '2',
          name: '药品配送',
          description: '药品快递到家',
          icon: 'icon-truck',
          available: true
        }
      ]
      
      commit('SET_AVAILABLE_SERVICES', mockServices)
    } catch (error) {
      console.error('加载服务列表失败:', error)
    }
  }
}

const getters = {
  availableServices: state => state.availableServices,
  serviceCategories: state => state.serviceCategories
}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}